import random
import time
import numpy as np

# list_01 = []
# for i in range(10000000):
#     list_01.append(random.random())
# t1 = time.time()
# sum_01 = sum(list_01)
# t2 = time.time()
# list_02 = np.array(list_01)
# t3 = time.time()
# sum_02 = np.sum(list_02)
# t4 = time.time()
# print(t2 - t1, "\n", t4 - t3)
# print(type(list_02))
# print(list_02)
array_01 = np.arange(0, 10, 2)
print(array_01)
print(type(array_01))
list_01 = [[1, 2], [3, 4], [5, 6]]
array_02 = np.array(list_01)
print("list_01:\n", array_02)
print(array_02[0, :])
# get the type of object
print(type(array_02))
# get the dimension of an array
print(array_02.ndim)
# get the row and column of an array
print(array_02.shape)
# get the number of elements in an array
print(array_02.size)
array_03 = np.array([[1, 2, 3], [4, 5, 6]])
print(array_03)
print(array_03.shape)
array_04 = array_03.reshape(3, 2)
print(array_04)
array_05 = array_04.reshape((6,), order="F")
print(array_05)
array_06 = np.arange(24).reshape((6, 4))
array_07 = np.arange(100, 124).reshape((1, 24))
print(array_06)
sum_01 = np.sum(array_06, axis=0)
print("sum_01:", sum_01)
print(array_07)
array_08 = np.arange(27).reshape((3, 3, 3))
print(array_08)
sum_02 = np.sum(array_08, axis=2)
print("sum_02", sum_02)
print(array_08[0, :, :])
print(array_08[0:3, 0, :])
score = np.array([[80, 88], [82, 81], [75, 81]])
result = np.where(score > 80, True, False)
print(result)
array_09 = np.array([[1, 2, 3], [4, 5, 6]])
print(array_09)
print(np.append(array_09, [7, 8, 9]))
print(np.append(array_09, [[7, 8, 9]], axis=0))
print(np.append(array_09, [[7],[8]], axis=1))

